package com.ruoyi.common.utils;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.config.RuoYiConfig;

public class FaceUtil {

    /**
     * 根据图片路径获取图片字节数组静态方法
     */
    public static byte[] getImageByte(String imagePath) {
        byte[] imageByte = null;
        imagePath = StrUtil.replace(imagePath, "/profile/", RuoYiConfig.getProfile() + "/");
        try {
            imageByte = FileUtil.readBytes(imagePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return imageByte;
    }

}
